class DateTimeHelper {
  const DateTimeHelper._();

  static DateTime now = DateTime.now();

  ///获取年
  static int get getYear => now.year;

  ///获取月
  static int get getMonth => now.month;

  ///获取日
  static int get getDay => now.day;

  ///获取时
  static int get getHour => now.hour;

  ///获取分
  static int get getMinute => now.minute;

  ///获取秒
  static int get getSecond => now.second;

  ///获取微秒
  static int get getCurrentMillisecondsSinceEpoch => now.millisecondsSinceEpoch;

  //时间间隔转化为 *天*小时*分
  static getFormatterTime(int interval) {
    int day = interval / 60 ~/ 24;
    int hour = (interval / 60 % 24).toInt();
    int min = (interval % 60).toInt();
    String back = "";
    if (day > 0) {
      back += "$day天";
    }
    if (hour > 0) {
      back += "$hour小时";
    }
    if (min > 0) {
      back += "$min分";
    }
    return back;
  }
}

class DateTimeFormat {
  DateTimeFormat._();

  static const String def = 'yyyy-MM-dd HH:mm:ss';
  static const String def_zh = 'yyyy年MM月dd日 HH点mm分ss秒';
  static const String ymd_hm = 'yyyy-MM-dd HH:mm';
  static const String ymd_hm_zh = 'yyyy年MM月dd日 HH点mm分';
  static const String ymd = 'yyyy-MM-dd';
  static const String ymd_zh = 'yyyy年MM月dd日';
  static const String ym = 'yyyy-MM';
  static const String ym_no_line = 'yyyyMM';
  static const String md = 'MM-dd';
  static const String md_zh = 'MM月dd日';
  static const String hms = 'HH:mm:ss';
  static const String hms_zh = 'HH点mm分ss秒';
  static const String rfc3339 = 'yyyy-MM-dd\'T\'HH:mm:ss\'.0Z\'';
}
